/**
 * @param {number[]} numbers
 * @param {number} target
 * @return {number[]}
 * @desc输入：numbers = [-1,0], target = -1
 输出：[1,2]
 解释：-1 与 0 之和等于目标数 -1 。因此 index1 = 1, index2 = 2 。返回 [1, 2] 。
 */
var twoSum = function (numbers, target) {
    // 构造哈希表
    var map = new Map();
    for (let i = 0; i < numbers.length; i++) {
        let complement = target - nums[i];
        if (map.has(complement)) {
            return [map.get(complement) + 1, i + 1];
        }
        map.set(numbers[i], i);
    }
    console.log("No two sum solution");
};

